*PREAMBLE
set matsize 160
xtset  codigo ao

*INTERPRET OUR VARIABLES WITH DESCRIPTIVE STATISTICS
xtsum agnu cinc
xttab codigo
xtline agnu, i(pais) t(ao)
xtline cinc, i(pais) t(ao)
xtline cinc_gap, i(pais) t(ao)
xtline agnu dictadura, i(pais) t(ao)

**************************
*UNIT ROOT TESTS

xtunitroot llc  agnu
* IT HAS NO UNIT ROOTS

xtunitroot llc  cinc
* IT HAS NO UNIT ROOTS

 xtunitroot llc  fdi
*CANT BE TESTED

 xtunitroot llc  fmi
* HAS UNIT ROOTS

 xtunitroot llc  bm
* HAS UNIT ROOTS

*WE WILL HAVE TO DIFFERENTIATE AGNU, CINC, TLC AND DICTATORSHIP

***************************
*TESTING FOR AUTOCORRELATION and HETEROSCEDASTICITY IN OUR DATA.

*AUTOCORRELATION
findit xtserial
xtserial agnu cinc fdi fmi bm tlc dictadura, output


xtreg agnu cinc fdi fmi bm tlc dictadura
findit pantest2
pantest2 ao

*HETEROSCEDASTICITY
xtreg agnu cinc fdi fmi bm tlc dictadura
findit xttest3
xttest3

* HOW TO SOLVE IT? BY USING XTPCSE

xtreg agnu cinc fdi fmi bm tlc dictadura
xtcsd, pesaran

xtpcse  agnu cinc fdi fmi bm tlc, corr(ar1)
xtscc agnu cinc fdi fmi bm tlc dictadura


***************************

*REGRESSION MODELS

*APPENDIX E


xtpcse agnu cinc cinc_gap
estimates store m1

xtpcse agnu schen cinc_gap
estimates store m1a

xtpcse  agnu cinc cinc_gap fdi fmi bm dictadura 
estimates store m31

xtpcse  agnu cinc cinc_gap fdi fmi bm polity 
estimates store m32

xtpcse  agnu cinc cinc_gap fdi fmi bm freedom 
estimates store m33

xtpcse  agnu schen cinc_gap fdi fmi bm dictadura 
estimates store m3a

xtpcse  agnu schen cinc_gap fdi fmi bm polity 
estimates store m3b

xtpcse  agnu schen cinc_gap fdi fmi bm freedom 
estimates store m3c

esttab m1 m1a m31 m32 m33 m3a m3b m3c,cells(b(star fmt(2)) p(par fmt(2))) legend label varlabels (_cons Constant) nonumbers mtitles("Model 1""Model 2""Model 3.1""Model 3.2""Model 3.3""Model 4.1""Model 4.2""Model 4.3")

*TABLE 2 


xtpcse  d.agnu d.cinc l.d.cinc_gap fdi fmi bm d.dictadura , i
estimates store m333

xtpcse  d.agnu d.schen l.d.cinc_gap fdi fmi bm d.dictadura , i
estimates store m333a

xtpcse  d.agnu d.cinc l.d.cinc_gap fdi fmi bm d.polity , i
estimates store m3333

xtpcse  d.agnu d.schen l.d.cinc_gap fdi fmi bm d.polity , i
estimates store m333aa

xtpcse  d.agnu d.cinc l.d.cinc_gap fdi fmi bm l.d.freedom , i
estimates store m33333

xtpcse  d.agnu d.schen l.d.cinc_gap fdi fmi bm l.d.freedom , i
estimates store m333aaa


esttab m333 m333a m3333 m333aa m33333 m333aaa ,cells(b(star fmt(2)) p(par fmt(2))) legend label varlabels (_cons Constant) nonumbers mtitles("Model 5.1""Model 6.1""Modelo 5.2""Model 6.2""Model 5.3""Model 6.3")

* TABLE 3
*To replicate table 5 use the second database, called Table5.dta

xtset  codigo ao
tab region
tab pais  if region==1
tab pais  if region==2
tab pais  if region==3
tab pais  if region==4

xtpcse  d.agnu d.cinc l.d.cinc_gap if region==1, i
estimates store aa

xtpcse  d.agnu d.schen l.d.cinc_gap if region==1, i
estimates store bb

xtpcse  d.agnu d.cinc d.schen l.d.cinc_gap if region==1, i
estimates store cc

esttab aa bb cc

xtpcse  d.agnu d.cinc l.d.cinc_gap if region==2, i
estimates store dd

xtpcse  d.agnu d.schen l.d.cinc_gap if region==2, i
estimates store ee

xtpcse  d.agnu d.cinc d.schen l.d.cinc_gap if region==2, i
estimates store ff

esttab dd ee ff

xtpcse  d.agnu d.cinc l.d.cinc_gap if region==3, i
estimates store gg

xtpcse  d.agnu d.schen l.d.cinc_gap if region==3, i
estimates store hh

xtpcse  d.agnu d.cinc d.schen l.d.cinc_gap if region==3, i
estimates store ii

esttab gg hh ii

xtpcse  d.agnu d.cinc l.d.cinc_gap if region==4, i
estimates store jj

xtpcse  d.agnu d.schen l.d.cinc_gap if region==4, i
estimates store kk

xtpcse  d.agnu d.cinc d.schen l.d.cinc_gap if region==4, i
estimates store ll

esttab jj kk ll


esttab aa bb cc dd ee ff gg hh ii jj kk ll ,  mtitles("Lat Am.1""Lat Am.2""Lat Am.3""Africa.1""Africa.2""Africa.3""East Asia.1""East Asia.2""East Asia.3""Europe.1""Europe.2""Europe.3")


* (Not included in the paper)Graphical representation of Power Gap variable
 
 egen zagnu = std(agnu)
 egen zcinc = std(cinc)
 egen zcinc_gap = std(cinc_gap)
 
 
 twoway scatter zagnu zcinc_gap || lfitci zagnu zcinc_gap, by(pais)
 
 




